<div>
  <div class="pull-right">
    <%= link_to "新建设计师活动", new_admin_designer_promotion_path, class: "btn btn-primary" %>
  </div>

  <h1>
    设计师活动(<%= @designer_promotions.total_entries %>)
  </h1>
</div>

<div>
  <table class="table table-striped">
    <tr>
      <th>主图</th>
      <th class="col-xs-2">标题</th>
      <th class="col-xs-6">正文</th>
      <th>操作</th>
    </tr>

    <% @designer_promotions.each do |designer_promotion| %>
      <tr>
        <td><%= image_tag designer_promotion.main_img, { width: '150px', height: '150px'} %></td>
        <td><%= designer_promotion.title %></td>
        <td><%= strip_tags(designer_promotion.content).truncate(100) %></td>
        <td align="right">
          <%= link_to "编辑", edit_admin_designer_promotion_path(designer_promotion) %>
          &nbsp;&nbsp;
          |
          &nbsp;&nbsp;

          <% if designer_promotion.deleted? %>
            已删
          <% else %>
            <%= link_to '删除',  admin_designer_promotion_path(designer_promotion), method: :delete, data: {confirm: "确认删除服务网点？"} %>
          <% end %>
        </td>
      </tr>
    <% end -%>
  </table>

  <%= will_paginate @designer_promotions %>
</div>
